package com.fce.fcesystem.utils;

import org.springframework.mail.SimpleMailMessage;

/**
 * @Description: 发送邮件验证码
 */
public class EmailLoad {
    /**
     * 发送邮件
     * @param code 验证码
     * @param from 发送验证码的邮箱
     * @param to 接收验证码的邮箱
     * @return true 发送成功，否则发送失败
     */
    public static SimpleMailMessage sendEmailCode(String code, String from, String to) {
        // 用来设置邮件信息
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        // 设置邮件标题
        simpleMailMessage.setSubject("登录验证码");
        // 设置邮件内容
        simpleMailMessage.setText("您收到的验证码是：" + code);
        // 设置源邮箱
        simpleMailMessage.setFrom(from);
        // 设置目的邮箱
        simpleMailMessage.setTo(to);
        return simpleMailMessage;
    }
}

